import { BasicColumn, FormSchema } from '@/components/Table';
import { DescItem } from '@/components/Description';

/**
 * 表格列
 */
export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 80,
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 80,
  },
  {
    title: '数量限制',
    dataIndex: 'limitPerPerson',
    width: 80,
  },
  {
    title: '金额',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '最低使用金额',
    dataIndex: 'minSpend',
    width: 80,
  },
  {
    title: '总发行数量',
    dataIndex: 'totalQuantity',
    width: 80,
  },
  {
    title: '剩余数量',
    dataIndex: 'residueQuantity',
    width: 80,
  },
  {
    title: '生效开始时间',
    dataIndex: 'startTime',
    width: 80,
  },
  {
    title: '失效结束时间',
    dataIndex: 'endTime',
    width: 80,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
  },
  {
    title: '所属店铺ID',
    dataIndex: 'storeId',
    width: 80,
  },
  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 80,
  },
];

/**
 * 查询条件
 */
export const queryFormSchema: FormSchema[] = [];

/**
 * 查看详情表单
 */
export const retrieveDetailFormSchema: DescItem[] = [
  {
    field: 'name',
    label: '名称',
  },
  {
    field: 'type',
    label: '类型',
  },
  {
    field: 'limitPerPerson',
    label: '数量限制',
  },
  {
    field: 'amount',
    label: '优惠金额',
  },
  {
    field: 'minSpend',
    label: '最低消费金额',
  },
  {
    field: 'totalQuantity',
    label: '总发行数量',
  },
  {
    field: 'residueQuantity',
    label: '剩余数量',
  },
  {
    field: 'startTime',
    label: '优惠券生效开始时间',
  },
  {
    field: 'endTime',
    label: '优惠券失效结束时间',
  },
  {
    field: 'status',
    label: '优惠券状态',
  },
  {
    field: 'storeId',
    label: '所属店铺ID',
  },
  {
    field: 'createdAt',
    label: '创建时间',
  },
  {
    field: 'updatedAt',
    label: '更新时间',
  },
];

/**
 * 新增/编辑表单
 */
export const insertOrUpdateFormSchema: FormSchema[] = [
  {
    field: 'id',
    // 只是为了把ID带过来
    label: '主键ID',
    component: 'Render',
    ifShow: false,
  },
  {
    field: 'name',
    label: '优惠券名称',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'type',
    label: '优惠券类型',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'limitPerPerson',
    label: '每人可领取的数量限制',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'amount',
    label: '优惠金额',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'minSpend',
    label: '最低消费金额',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'totalQuantity',
    label: '优惠券总发行数量',
    required: true,
    component: 'Input',
    componentProps: {},
  },

  {
    field: 'startTime',
    label: '优惠券生效开始时间',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'endTime',
    label: '优惠券失效结束时间',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'status',
    label: '优惠券状态',
    required: false,
    component: 'Input',
    componentProps: {},
  },
];
